﻿using AutoMapper;
using Microsoft.EntityFrameworkCore;
using TrackSystem.Contracts;
using TrackSystem.Entities.Models;

namespace TrackSystem.EntityFramework.Repositories
{
    public class EquipRepository : Repositories<EquipTable, int>, IEquipRepository
    {
        private readonly IMapper _mapper;
        public EquipRepository(TkDBContent dbContent, IMapper Mapper) : base(dbContent)
        {
            _mapper = Mapper;
        }

        public async Task<IEnumerable<EquipTable>> GetEquipWithSensorsAsync()
        {
            return  await _dbContext.Equip.Select(a => a)
                .Include(a => a.Sensors)
                .Include(a => a.Logics)
                .Include(a => a.Loops)
                .ToArrayAsync();
        }
    }
}
